line chart with dynamic legend